package juc.test;

public class SynchronizedDemo {
    public static void main(String[] args) {
        SynchronizedDemo synchronizedDemo = new SynchronizedDemo();
        synchronizedDemo.method1();
    }

    public synchronized void method1(){
        System.out.println(Thread.currentThread().getName() + "：method1");
        method2();
    }

    public synchronized  void method2(){
        System.out.println(Thread.currentThread().getName() + "：method2");
        method3();
    }

    public synchronized void method3(){
        System.out.println(Thread.currentThread().getName() + "：method3");
    }
}
